
function getText(obj){
    //提取出id 'https://www.jiayuan.com/242947955?fxly=search_v2_index'
    var text = $(obj).attr("href");
    if(text){
        var id=text.substr(text.indexOf('.com/')+5);
        id=id.substr(0,id.indexOf('?'));
        return id;
    }else{
        return null;
    }
}

setInterval(function () {
    var list = [];
    $('.hy_box').each(function() {
        list.push(getText($(this).find(".openBox")));
    });

    $.ajax({
        url: 'http://127.0.0.1:1030/check/checkJ',
        method: 'POST',
        type:'POST',
        contentType: 'application/json',
        data: JSON.stringify(list),
        success: function(data) {
            $('.hy_box').each(function() {
                var currentId =getText($(this).find(".openBox"));
                if (data.includes(currentId)) {
                    $(this).html("");
                    $(this).hide();
                }
            });
            if(!has()){

            }
        }
    });
}, 5000);

function has(){
    var hasId=false;
    $('.hy_box').each(function() {
        var currentId =getText($(this).find(".openBox"));
        if (currentId) {
            hasId=true;
        }
    });
    return hasId;
}